// pages/search/search.js

var pinyin = require("../../utils/dist/index");
Page({
  /**
   * 页面的初始数据
   */
  data: {
    movieList: []
  },
  setInput(e) {
    var result = pinyin.convertToPinyin(e.detail);
    wx.request({
      url: 'http://www.h5yjy.com/api/searchList?cityId=10&kw=' + result,
      success: (res) => {
        var rel = res.data.data;
        if (rel.movies) {
          var movieList = rel.movies.list;
        } else {
          var movieList = [];
        }
        movieList.map((item) => {
          item.img = item.img.replace("w.h", "66.94");
        })
        console.log(movieList)
        this.setData({
          movieList
        });
      }
    })
  },
  goBack() {
    wx.navigateBack({
      delta: 1
    })
  },

})